<template>
    <div>
       <input type="text" v-model="title">
       <button @click="addTitle">添加任务</button>
    </div>
</template>

<script>
import event from './event.js';
export default {
    data(){
      return {
          title:""
      }
    },
    methods:{
        addTitle(){
             //调用父组件
             this.$emit('add',this.title)


             //调用自定义事件
             event.$emit('onAddTitle',this.title)
             this.title = ""
        }
    }
}
</script>

<style>

</style>